package com.ray.util;
import java.text.SimpleDateFormat;
public class GUID {
	private static int Guid=100;
	public static long getGuid() {	
		GUID.Guid+=1;
		long now = System.currentTimeMillis();  
		//四位年份
		SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy");  
		//时间戳
		String time=dateFormat.format(now);
		String info=now+"";
		//3位随机数
		//int ran=(int) ((Math.random()*9+1)*100); 
		int ran=0;
		if(GUID.Guid>999){
			GUID.Guid=100;    	
		}
		ran=GUID.Guid;
		String str =  time+info.substring(2, info.length())+ran; 
		long result =-1;
		try {
			result= Long.parseLong(str);
		} catch (NumberFormatException e) {
		    e.printStackTrace();
		}
		return result;
	}
}
